package com.Jin.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Autowired
    private IdentifyInterceptor identifyInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //登录拦截
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/","/index","/register","/css/**","/js/**",
                        "font-awesome/**","/elementui/**","/user/**","/favicon.ico");
        //权限拦截
        registry.addInterceptor(identifyInterceptor)
                .addPathPatterns("/usermain","/rootmain")
                .excludePathPatterns("/","/index","/register","/css/**","/js/**",
                        "font-awesome/**","/elementui/**","/user/**","/favicon.ico");
    }

}
